from flask import Blueprint, request,render_template
from models import (House)
#创建蓝图对象
list_page = Blueprint('list_page', __name__)
@list_page.route('/query')
def search_txt_info ():
    #获取addr字段的查询结果结果
    if request.args.get('addr'):
       addr = request.args.get('addr')
       result = House.query.filter(House.address == addr).order_by(House.publish_time.desc()).all()
       return render_template('search_list.html',house_list=result)
    #获取rooms字段的查询结果
    if request.args.get('rooms'):
       rooms_info = request.args.get('rooms')
       result = House.query.filter(House.rooms == rooms_info).order_by(House.publish_time.desc()).all()
       return render_template('search_list.html',house_list=result)